﻿using Microsoft.EntityFrameworkCore.Migrations;

namespace FurnitureDesign.EFCore.Migrations
{
    public partial class Ptoduct : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "designers",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    DesignerName = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    Sex = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    Age = table.Column<int>(type: "int", nullable: false),
                    Segment = table.Column<string>(type: "nvarchar(max)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_designers", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "messages",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    MessageName = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    MessageContent = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    ReplyContent = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    MessageTime = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    ReplyTime = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    State = table.Column<string>(type: "nvarchar(max)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_messages", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "productTypes",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    ProductTypeName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_productTypes", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "realInfoTypes",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    RealInfoTypeName = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_realInfoTypes", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "users",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    Name = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    Sex = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    Age = table.Column<int>(type: "int", nullable: false),
                    IDNumber = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    Phone = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    Password = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    Email = table.Column<string>(type: "nvarchar(max)", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_users", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "products",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    ProductName = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    ProductmMterial = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    Price = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    MarketValue = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    Brand = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    Colour = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    ProductTypeId = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_products", x => x.Id);
                    table.ForeignKey(
                        name: "FK_products_productTypes_ProductTypeId",
                        column: x => x.ProductTypeId,
                        principalTable: "productTypes",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.CreateTable(
                name: "realInfos",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    RealInfoName = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    Content = table.Column<string>(type: "nvarchar(max)", nullable: false),
                    RealInfoTypeId = table.Column<int>(type: "int", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_realInfos", x => x.Id);
                    table.ForeignKey(
                        name: "FK_realInfos_realInfoTypes_RealInfoTypeId",
                        column: x => x.RealInfoTypeId,
                        principalTable: "realInfoTypes",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.InsertData(
                table: "designers",
                columns: new[] { "Id", "Age", "DesignerName", "Segment", "Sex" },
                values: new object[,]
                {
                    { 1, 28, "史密斯KIM", "首席金牌设计师", "男" },
                    { 2, 25, "刘凯丽", "首席金牌设计师", "女" },
                    { 3, 32, "小李子", "首席金牌设计师", "男" },
                    { 4, 27, "Lisa", "首席金牌设计师", "女" }
                });

            migrationBuilder.InsertData(
                table: "messages",
                columns: new[] { "Id", "MessageContent", "MessageName", "MessageTime", "ReplyContent", "ReplyTime", "State" },
                values: new object[,]
                {
                    { 8, "很漂亮", "欢欢", "2021-01-02", "", "", "未回复" },
                    { 6, "很漂亮", "哈哈", "2021-01-02", "", "", "未回复" },
                    { 5, "很漂亮", "红红", "2021-01-02", "", "", "未回复" },
                    { 7, "很漂亮", "水水", "2021-01-02", "感谢支持", "2021-03-08", "已回复" },
                    { 3, "很漂亮", "敏敏", "2021-01-02", "感谢支持", "2021-03-08", "已回复" },
                    { 2, "很漂亮", "琳琳", "2021-01-02", "", "", "未回复" },
                    { 1, "很漂亮", "菲菲", "2021-01-02", "感谢支持", "2021-03-08", "已回复" },
                    { 4, "很漂亮", "蹦蹦", "2021-01-02", "感谢支持", "2021-03-08", "已回复" }
                });

            migrationBuilder.InsertData(
                table: "productTypes",
                columns: new[] { "Id", "ProductTypeName" },
                values: new object[,]
                {
                    { 1, "椅子" },
                    { 2, "餐桌" },
                    { 3, "沙发" }
                });

            migrationBuilder.InsertData(
                table: "realInfoTypes",
                columns: new[] { "Id", "RealInfoTypeName" },
                values: new object[,]
                {
                    { 1, "新闻资讯" },
                    { 2, "化工资讯" },
                    { 3, "汽车资讯" }
                });

            migrationBuilder.InsertData(
                table: "users",
                columns: new[] { "Id", "Age", "Email", "IDNumber", "Name", "Password", "Phone", "Sex" },
                values: new object[,]
                {
                    { 3, 15, "1245@qq.com", "45896321546954863", "冰冰", "123456", "12345678945", "女" },
                    { 1, 16, "1245@qq.com", "45896321546954863", "小白", "123456", "12345678945", "女" },
                    { 2, 17, "1245@qq.com", "45896321546954863", "大白", "123456", "12345678945", "男" },
                    { 4, 18, "1245@qq.com", "45896321546954863", "花花", "123456", "12345678945", "男" }
                });

            migrationBuilder.InsertData(
                table: "products",
                columns: new[] { "Id", "Brand", "Colour", "MarketValue", "Price", "ProductName", "ProductTypeId", "ProductmMterial" },
                values: new object[,]
                {
                    { 1, "xxx", "红色", "600", "580", "软皮椅", 1, "真皮" },
                    { 2, "xxx", "红色", "350", "300", "硬皮椅", 1, "真皮" },
                    { 3, "xxx", "红色", "2200", "2000", "餐桌椅", 2, "真皮" },
                    { 4, "xxx", "红色", "2800", "2500", "餐桌爱心椅", 2, "真皮" },
                    { 5, "xxx", "红色", "9999", "9999", "软沙发", 3, "真皮" },
                    { 6, "xxx", "红色", "5899", "5698", "硬沙发", 3, "真皮" }
                });

            migrationBuilder.InsertData(
                table: "realInfos",
                columns: new[] { "Id", "Content", "RealInfoName", "RealInfoTypeId" },
                values: new object[,]
                {
                    { 1, "2021年7月21日，人民网发布《人民网“十四五”发展规划》将“做精内容主业”作为“十四五”时期的重点任务之一，特别提出全力发展新型内容业务，运用新一代人工智能与大数据、云计算等技术，聚合主流媒体、各类机构以及社会创作力量的优质内容，面向政府、企业、机构应用场景，为各类传播终端和智能产品提供“内容批发市场”分发服务，该服务由人民科技全面负责。", "人民资讯聚合分发构建价值内容生态", 1 },
                    { 2, "优质内容更需要全方位的推荐和分发，扩大其影响价值。百度移动生态的“搜索+推荐”为服务化打造双引擎能力基础，通过百度AI技术加持，不仅为用户提供个性化的信息，还实现了从“人找信息”转向“信息找人”，实现精准分发。", "AI智能分发驱动“信息找人”，加深优质内容链接", 1 },
                    { 3, "近期，化工板块指数出现持续调整。同花顺数据显示，9月29日，申万化工指数收报4888点，下跌4.13%，相比16日高点下跌16.92%。但相比于年初，板块上涨约33.95%。\r\n                             从个股走势看，湖北宜化、安纳达等多只个股当日跌停，而此前上述公司股价一度表现强势。以湖北宜化为例，9月14日一度上探至27.9元高点，截至29日收盘，回调幅度约35 % (前复权，下同)，但相比于年初涨幅仍超4倍；安纳达股价年内同样出现大幅上涨，但近期股价急跌，连续三个交易日跌停。\r\n                             东莞证券认为，化工行业企业能耗较高，由于限产等状况的出现，引发市场对于化工企业开工率和后续产销量的担忧，导致了板块出现下跌。", "化工板块下跌 部分产品价格回调", 2 },
                    { 4, "近日，中化资本旗下中化资本创投作为领投方，完成对山东天一化学股份有限公司(简称天一化学)的战略投资。\r\n                             天一化学为国家高新技术企业、省级“专精特新”企业，是山东省现代海洋领军民企十强，公司业务领域覆盖阻燃剂、水性功能单体、均相离子交换膜等板块。\r\n                             天一化学目前为国内溴系阻燃剂行业龙头企业，产品品类齐全，结构合理，拥有梯度明确的高分子溴系阻燃剂、十溴系列阻燃剂产品，是国内产品种类最齐全的溴系阻燃剂供应商。公司的均相离子交换膜业务拥有完全自主知识产权，曾获国家技术发明二等奖，牵头制定化工行业标准3项，主持承担包括2项国家“863”计划在内的多项科技计划。公司的水性功能单体产品双丙酮丙烯酰胺(DAAM)，主要用于生产交联剂和聚氨酯分散剂，产品己二酸二酰肼(ADH)，用于环氧粉末涂料固化剂和涂料助剂。\r\n                             本次股权合作协同效应突出，天一化学是中国中化旗下工程塑料业务产业链上企业，中化资本创投旗下中化绿色基金以及中化高新基金作为本轮联合领投方，将充分嫁接中国中化在材料科学领域的领先优势，搭建更多业务合作的桥梁。中化资本创投将利用中国中化产业资源优势协助天一化学补充新型磷系阻燃剂业务及扩产环保型阻燃剂产品，助力天一化学产品创新及产业升级。", "中化资本创投领投天一化学助力山东化工产业升级", 2 },
                    { 5, "两款新增车型的主要变化在续航和配置上，相较之前的智行版， 480G/670G增加了12项舒适性功能/配置，如智能车语、主驾记忆+通风+电动腰托、前排座椅加热、手机无线充电、前/后排头部气囊、前向碰撞预警FCW等，在降低起售价的同时，增加舒适性及安全性配置。\r\n                             此外，今后小鹏P7的命名原则改为 车型+NEDC续航+智能梯度+特殊版型， 如原后驱长续航智享版，更名后为586N， 原车型名不再保留，全系统一。后缀PENG为智能梯度划分，分别对应P（Premium）高配，高贵版，为目前在售智能配置最高版本，以此类推为E（Elite）次高配，菁英版；N（Novel）中配，创新版；G（Glamorous）标配，独特版。 ", "售21.99万元起 小鹏P7新增车型上市", 3 },
                    { 6, "作为与华为联合打造的产品，该车车内最大的亮点莫过于那块20.3英寸的大屏，它将仪表盘、中控大屏和副驾屏幕汇集到了一起，4K的分辨率支持高清视频的播放，并且这块屏幕在防眩、反射方面也做了处理。得益于华为鸿蒙操作系统，阿尔法S车机系统也融入了多种应用生态供用户使用。", "2021天津车展：极狐阿尔法S华为HI版", 3 }
                });

            migrationBuilder.CreateIndex(
                name: "IX_products_ProductTypeId",
                table: "products",
                column: "ProductTypeId");

            migrationBuilder.CreateIndex(
                name: "IX_realInfos_RealInfoTypeId",
                table: "realInfos",
                column: "RealInfoTypeId");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "designers");

            migrationBuilder.DropTable(
                name: "messages");

            migrationBuilder.DropTable(
                name: "products");

            migrationBuilder.DropTable(
                name: "realInfos");

            migrationBuilder.DropTable(
                name: "users");

            migrationBuilder.DropTable(
                name: "productTypes");

            migrationBuilder.DropTable(
                name: "realInfoTypes");
        }
    }
}
